package angel.core.service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import angel.core.model.SearchCriteria;


public interface ICrudService<T, ID extends Serializable>
{   
    /**
     * @param id
     * @return
     */
    T getById(ID id);
    
    /**
     * @param sample
     * @param includedProperties
     * @return
     */
    List<T> getBySample(T sample, String... includedProperties);
    
    /**
     * @param searchCriteria
     * @return
     */
    List<T> getByCriteria(SearchCriteria searchCriteria);
    
    /**
     * @param properties
     * @return
     */
    List<T> getByCriteria(Map<String,Object> properties);
    
    /**
     * get all models by runtime criteria specified in the model 
     * @param model
     * @param subject
     * @param screenMode
     * @return
     */
    public List<T> getByCriteria(T model,String subject,String screenMode);
    /**
     * @param entity
     * @return
     */
    T save(T entity);
    
    /**
     * @param id
     * @return
     */
    boolean remove(ID id);
}
